home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / arexx / rexxbgui / conditional.rexx < prev    next >
OS/2 REXX Batch file  |  1999-06-14  |  2KB  |  89 lines

  1. /* REXX script for rexxbgui.library: conditional notification */
  2.  
  3. if ~show('l','rexxbgui.library') then do
  4.     if ~addlib('rexxbgui.library',0,-30) then do
  5.         exit(20)
  6.     end
  7.     else nop
  8. end
  9. else nop
  10.  
  11. call bguiopen() /* causes error 12 if it did not work */
  12. /* supply a second argument for a '0' return code instead of an ARexx
  13.    error */
  14.  
  15. signal on syntax /* important: bguiclose() MUST be called */
  16. signal on halt
  17. signal on break_c
  18.  
  19. esc='1B'x
  20. lf='0A'x
  21. cr='0D'x
  22. grspace.narrow=-1
  23. grspace.normal=-2
  24. grspace.wide=-3
  25. FixMinSize=bguilayout(LGO_FixMinWidth,1,LGO_FixMinHeight,1)
  26.  
  27. /* using ARexx feature: ,<newline> is translated to nothing */
  28. /* the || are essential - any added space will cause trouble */
  29. /* redefining the same ID makes previous buttons unaccessible */
  30. /* do not redefine winclose etc. */
  31.  
  32. g=bguivgroup(,
  33.     bguiinfo(,
  34.         'info',,'cbRexxBGUI-b: conditional notification',
  35.     )||bguilayout(LGO_FixMinHeight,1)||,
  36.     bguihgroup(,
  37.         bguivarspace(50)||,
  38.         bguivgroup(,
  39.             bguicheckbox('dismx','_Disable MX object',0)FixMinSize||,
  40.             bguicheckbox('disi2','D_isable "iItem 2-i"',0)FixMinSize,
  41.         )||,
  42.         bguivarspace(50),
  43.     )||bguilayout(LGO_FixMinHeight,1)||,
  44.     bguihgroup(,
  45.         bguivarspace(50)||,
  46.         bguimx('mx','_MX object',bguilist('it','Item 1','Item 2'),'R')FixMinSize||,
  47.         bguivarspace(50),
  48.     )||bguilayout(LGO_FixMinHeight,1)||,
  49.     bguihgroup(,
  50.         bguivarspace(50)||,
  51.         bguibutton('quit','_Quit')||,
  52.         bguivarspace(50),
  53.     )||bguilayout(LGO_FixMinHeight,1),
  54. ,grspace.normal,grspace.normal)
  55.  
  56. drop it.
  57.  
  58. call bguiaddmap(obj.dismx,obj.mx,GA_Selected,GA_Disabled)
  59. call bguiaddmap(obj.dismx,obj.disi2,GA_Selected,GA_Disabled)
  60. call bguiaddcondit(obj.dismx,obj.disi2,GA_Selected,0,GA_Selected,0,TAG_IGNORE,0)
  61. call bguiaddcondit(obj.disi2,obj.mx,GA_Selected,0,MX_EnableButton,1,MX_DisableButton,1)
  62. call bguiaddcondit(obj.disi2,obj.mx,GA_Selected,0,TAG_IGNORE,0,MX_Active,0)
  63.  
  64. a=bguiwindow('Conditional',g,'-','-',,arg(1),'mouse')
  65.  
  66. if bguiwinopen(a)=0 then bguierror(12)
  67. id=0
  68. do while bguiwinwaitevent(a,'ID')~=id.winclose
  69.     select
  70.         when id=id.winactive then nop
  71.         when id=id.wininactive then nop
  72.         when id=id.quit then leave
  73.         when id=id.winclose then nop
  74.         otherwise nop
  75.     end
  76. end
  77. rc=0
  78.  
  79. syntax:
  80. if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
  81. call bguiclose()
  82. exit 0
  83.  
  84. break_c:
  85. halt:
  86. rc=0
  87. say '+++ Break at line' sigl
  88. signal syntax
  89.